package com.lxh.lxhcrm.model.pojos;

import javax.persistence.*;
import java.sql.Date;
import java.util.List;
import java.util.Objects;

/**
 * 入库表
 */
@Entity
public class InWare {
    private int inId;
    private Date inDate;
    private Integer state;
    private String remark;
    private String inDan;

    private Caigou caigou;
    private Emp emp;

    @OneToOne
    @JoinColumn(name = "cai_id")
    public Caigou getCaigou() {
        return caigou;
    }

    public void setCaigou(Caigou caigou) {
        this.caigou = caigou;
    }

    @ManyToOne
    @JoinColumn(name = "emp_id")
    public Emp getEmp() {
        return emp;
    }

    public void setEmp(Emp emp) {
        this.emp = emp;
    }

    @Id
    @Column(name = "in_id", nullable = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public int getInId() {
        return inId;
    }

    public void setInId(int inId) {
        this.inId = inId;
    }

    @Basic
    @Column(name = "in_dan", nullable = true)
    public String getInDan() {
        return inDan;
    }

    public void setInDan(String inDan) {
        this.inDan = inDan;
    }

    @Basic
    @Column(name = "in_date", nullable = true)
    public Date getInDate() {
        return inDate;
    }

    public void setInDate(Date inDate) {
        this.inDate = inDate;
    }

    @Basic
    @Column(name = "remark", nullable = true, length = 200)
    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    @Basic
    @Column(name = "state", nullable = true)
    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        InWare inWare = (InWare) o;
        return inId == inWare.inId &&
                Objects.equals(inDate, inWare.inDate) &&
                Objects.equals(state, inWare.state) &&
                Objects.equals(remark, inWare.remark) &&
                Objects.equals(inDan, inWare.inDan) &&
                Objects.equals(caigou, inWare.caigou) &&
                Objects.equals(emp, inWare.emp);
    }

    @Override
    public int hashCode() {
        return Objects.hash(inId, inDate, state, remark, inDan, caigou, emp);
    }
}
